# $Id: PKGBUILD 78594 2012-10-21 17:09:39Z bgyorgy $
# Maintainer: Balló György <ballogyor+arch at gmail dot com>

pkgname=gnome-activity-journal
pkgver=0.8.0
pkgrel=5
pkgdesc="Tool for easily browsing and finding files on your computer using the Zeitgeist engine"
arch=('any')
url="https://launchpad.net/gnome-activity-journal"
license=('GPL')
depends=('python2-gconf' 'zeitgeist' 'hicolor-icon-theme' 'xdg-utils')
makedepends=('python2-distutils-extra')
optdepends=('python2-libgnome: get thumbnail of image and video files' 
            'gstreamer0.10-python: add multimedia tooltip for audio and video files'
            'python2-pygments: get thumbnail of text files')
install=$pkgname.install
source=(http://launchpad.net/$pkgname/${pkgver%.*}/$pkgver/+download/$pkgname-$pkgver.tar.gz
        disable-set-background.patch
        bluebird_histogram.patch
        fix-indicator-icon.patch
        make-libgnomeui-optional.patch)
md5sums=('46e493f090b41a49cfce422203791bc0'
         '23f0ead4fe6161e6aa71c8ad19ac5695'
         '075953e6cc1f88d2fc588488957550ee'
         'b757b0c8e5ff06eb50d30f5028c5691b'
         'a158b002cf33efcfefb4fa06d7ef7da5')

build() {
  cd "$srcdir/$pkgname-$pkgver"
  sed -i 's@^#!.*python$@#!/usr/bin/python2@' src/config.py gnome-activity-journal

  # https://bugs.launchpad.net/gnome-activity-journal/+bug/882557
  patch -Np1 -i "$srcdir/disable-set-background.patch"

  # https://bugs.launchpad.net/gnome-activity-journal/+bug/924988
  patch -Np1 -i "$srcdir/bluebird_histogram.patch"

  # Use icon name instead of full path to fix indicator icon
  patch -Np1 -i "$srcdir/fix-indicator-icon.patch"

  # https://bugs.launchpad.net/gnome-activity-journal/+bug/871130
  patch -Np1 -i "$srcdir/make-libgnomeui-optional.patch"

  python2 setup.py build
}

package() {
  cd "$srcdir/$pkgname-$pkgver"

  python2 setup.py install --root=$pkgdir/ --optimize=1
}
